﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using DataObjects.Interfaces;
using DataObjects.Behaviours;

namespace DataObjects
{
    public class BaseObject
    {
        #region Attributs
        protected static readonly Random rand = new Random();

        private IBehaviour behaviour = null;
        private Guid id;
        #endregion

        #region Properties
        public IBehaviour Behaviour
        {
            get { return behaviour; }
            set
            {
                if (behaviour != null && behaviour.AssocitaedGameObject != null)
                    behaviour.AssocitaedGameObject = null;

                behaviour = value;
            }
        }

        public Guid Id
        {
            get { return id; }
            internal set { id = value; }
        }
        #endregion

        public BaseObject()
        {
            id = Guid.NewGuid();
        }

        public BaseObject(IBehaviour behaviour)
            : base()
        {
            Behaviour = behaviour;
        }
    }
}
